﻿@using System.Web.Mvc.Ajax
@using System.Web.Mvc.Html
@using MvcContrib.UI.Grid
@using nanoCMS.Blog.WebUI.Models
@model List<BlogCategoryVM>

<div class="widget">
	<div class="head"> <h5>Blog category list </h5> </div>

    

    <div class="rowElem">
        <div id="categoryEdit">
        
    
        </div>
    </div>
    @Ajax.ActionLink("Add category", "AddBlogCategory", "BlogCategory", new {area="Blog"}, new AjaxOptions { UpdateTargetId = "categoryEdit" })

	@{ Html.Grid(Model).Columns(column =>
				{
					column.For(x => x.Title).Named("Title");
					column.For(x=>x.Description).Named("Description");
					column.Custom(x=> Ajax.ActionLink("Edit", "EditBlogCategory", new { controller="BlogCategory", area="Blog", blogCategoryID = x.BlogCategoryID }, new AjaxOptions{UpdateTargetId = "categoryEdit"}) );
				}).Attributes(id => "listBlogCategories", @class => "display", width => "100%" ).Render(); }
</div>

<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery("#listBlogCategories").dataTable();    
    });

    
</script>